/*
 * 
 * LegendShop 多用户商城系统
 * 
 *  版权所有,并保留所有权利。
 * 
 */
package com.legendshop.oa.service.impl;

import java.util.List;

import com.legendshop.oa.dao.CustomerDao;
import com.legendshop.oa.model.Customer;
import com.legendshop.oa.service.CustomerService;
import com.legendshop.util.AppUtils;

/**
 * The Class CustomerServiceImpl.
 *  服务实现类
 */
public class CustomerServiceImpl  implements CustomerService{
   
   /**
     *
     * 引用的Dao接口
     */
    private CustomerDao customerDao;

    public void setCustomerDao(CustomerDao customerDao) {
        this.customerDao = customerDao;
    }

	/**
	 *  根据商城获取列表
	 */
    public List<Customer> getCustomer(String userName) {
        return customerDao.getCustomer(userName);
    }

   	/**
	 *  根据Id获取
	 */
    public Customer getCustomer(Long id) {
        return customerDao.getCustomer(id);
    }

   /**
	 *  删除
	 */ 
    public void deleteCustomer(Customer customer) {
        customerDao.deleteCustomer(customer);
    }

   /**
	 *  保存
	 */	    
    public Long saveCustomer(Customer customer) {
        if (!AppUtils.isBlank(customer.getId())) {
            updateCustomer(customer);
            return customer.getId();
        }
        return customerDao.saveCustomer(customer);
    }

   /**
	 *  更新
	 */	
    public void updateCustomer(Customer customer) {
        customerDao.updateCustomer(customer);
    }

}
